#include <dbg.h>
#include <gtest/gtest.h>
using namespace std;

class Solution {
public:
    int longestContinuousSubstring(string s) {
        if (s.empty()) {
            return 0;
        }

        int res = 1;
        int cnt = 1;
        for (int i = 1; i < s.size(); ++i) {
            if (s[i] == s[i - 1] + 1) {
                res = max(res, ++cnt);
            } else {
                cnt = 1;
            }
        }
        res = max(res, cnt);

        return res;
    }
};

TEST(TEST1, longestContinuousSubstring) {
    Solution s;
    EXPECT_EQ(s.longestContinuousSubstring("abacaba"), 2);
}

TEST(TEST2, longestContinuousSubstring) {
    Solution s;
    EXPECT_EQ(s.longestContinuousSubstring("abcde"), 5);
}

TEST(TEST3, longestContinuousSubstring) {
    Solution s;
    EXPECT_EQ(s.longestContinuousSubstring("awy"), 1);
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}